package org.feiye.studyday23;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateTest {

	public static void main(String[] args) {
		// 当前的日期
		Date date = new Date();
		System.out.println(date);
		// 格式化日期
		SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm：ss");
		String f = s.format(date);
		System.out.println(f);

		// 日期和时间
		Calendar c = Calendar.getInstance();
		// month是从0开始的.
		System.out
				.println(c.get(Calendar.YEAR) + "-" + (c.get(Calendar.MONTH) + 1) + "-" + c.get(Calendar.DAY_OF_MONTH));
		System.out.println("今天是星期：" + (c.get(Calendar.DAY_OF_MONTH)));

	}
}
